import axios from '@/common/axios';
import { API_URL } from '@/common/constants';

export const queryMaterialList = async (json) => {
  const { data } = await axios.post(`${API_URL}material/queryMaterialList`, json);
  return data;
};

export const saveMaterial = async (json) => {
  const { data } = await axios.post(`${API_URL}material/saveMaterial`, json);
  return data;
};

export const addMaterial = async (json) => {
  const { data } = await axios.post(`${API_URL}material/addMaterial`, json);
  return data;
};
export const queryMaterial = async (json) => {
  const { data } = await axios.post(`${API_URL}material/queryMaterial`, json);
  return data;
};


export const delMaterial = async (fNumber) => {
  const { data } = await axios.get(`${API_URL}material/delMaterial/${fNumber}`);
  return data;
};

export const forbidMaterial = async (fNumber) => {
  const { data } = await axios.get(`${API_URL}material/forbidMaterial/${fNumber}`);
  return data;
};

export const enableMaterial = async (fNumber) => {
  const { data } = await axios.get(`${API_URL}material/enableMaterial/${fNumber}`);
  return data;
};


export const exportData = async (json) => {
  const { data } = await axios.post(`${API_URL}material/exportData`, json, {
    responseType: 'blob',
  });
  return data;
};


export const queryMaterMeta = async () => {
  const { data } = await axios.get(`${API_URL}material/queryMaterMeta`);
  return data;
};



export const queryMaterialGroupList = async (json) => {
  const { data } = await axios.post(`${API_URL}materGroup/queryMaterialGroupList`, json);
  return data;
};

export const queryMaterialGroup = async (json) => {
  const { data } = await axios.post(`${API_URL}materGroup/queryMaterialGroup`, json);
  return data;
};

export const addMaterialGroup = async (json) => {
  const { data } = await axios.post(`${API_URL}materGroup/addMaterialGroup`, json);
  return data;
};





export const delMaterialGroup = async (fid) => {
  const { data } = await axios.get(`${API_URL}materGroup/delMaterialGroup/${fid}`);
  return data;
};



export const queryMaterCategoryList = async (fid) => {
  const { data } = await axios.get(`${API_URL}materCategory/queryMaterCategoryList`);
  return data;
};



